package day0728;

import java.util.Arrays;

public class Test10 {
    public static void main(String[] args) {
        int[]   cards={1,2,3,4,5,        6,7,8,9,10,       11,12,13,14,15};//1.准备15张牌
        shuffle(cards);//2.打乱15张牌的顺序(洗牌)
        int[]  a=new int[5];
        int[]  b=new int[5];
        int[]  c=new int[5];
        into3Arr(cards,a,b,c);//3.将15张牌放入到3个数组中
        System.out.println(Arrays.toString(a));
        System.out.println(Arrays.toString(b));
        System.out.println(Arrays.toString(c));
    }

    //将cards数组的元素，一个一个按顺序放入到a，b，c
    static void  into3Arr(int[]  cards,int[]  a,int[]  b,int[]  c){
        //将cards数组的元素逐个放入a中，b中，c中
        for (int i = 0; i <5 ; i++) {
            a[i]=cards[i];
            b[i]=cards[i+5];
            c[i]=cards[i+10];
        }
    }









    static void shuffle(int[]    cards){
        for (int i = cards.length-1;    i >=1 ;   i--) {//洗牌
            for (int j = 0; j <i ; j++) {
                int t=cards[i];
                cards[i]=cards[j];
                cards[j]=t;
            }
        }
    }

}





